home *** CD-ROM | disk | FTP | other *** search
/ PC Media 7 / PC MEDIA CD07.iso / share / prog / cm / cmhdict.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-06  |  1.7 KB  |  38 lines

  1. // CmHDict.h
  2. // -----------------------------------------------------------------
  3. // Compendium - C++ Container Class Library
  4. // Copyright (C) 1992-1994, Glenn M. Poorman, All rights reserved
  5. // -----------------------------------------------------------------
  6. // Hash dictionary definition.
  7. // -----------------------------------------------------------------
  8.  
  9. #ifndef _CMHDICT_H
  10. #define _CMHDICT_H
  11.  
  12. #include <cm/include/cmhash.h>
  13. #include <cm/include/cmassoc.h>
  14.  
  15. class CmHashDictionary : public CmHashTable {         // Dictionary definition.
  16. public:
  17.   CmHashDictionary(unsigned = 10);                    // Default constructor.
  18.   CmHashDictionary(const CmHashDictionary&);          // Copy constructor.
  19.  ~CmHashDictionary();                                 // Destructor.
  20.  
  21.   CmHashDictionary& operator=(const CmHashDictionary&); // Assignment operator.
  22.  
  23.   Bool           add         (CmObject*);             // Add association.
  24.   Bool           add         (CmObject*, CmObject*);  // Add key and object.
  25.   CmObject*      lookup      (CmObject*) const;       // Key from key.
  26.   CmObject*      lookupObject(CmObject*) const;       // Object from key.
  27.   CmAssociation* lookupAssoc (CmObject*) const;       // Association from key.
  28.   Bool           replace     (CmObject*, CmObject*);  // Replace object at key.
  29.   Bool           remove      (CmObject*);             // Remove key and object.
  30.   Bool           contains    (CmObject*) const;       // Key in dictionary?
  31.   unsigned       occurrences (CmObject*) const;       // Occurrences of key.
  32.   void           removeAll   ();                      // Remove all objects.
  33.  
  34.   CMOBJECT_DEFINE(CmHashDictionary, CmHashTable)      // Define object funcs.
  35. };
  36.  
  37. #endif
  38.